package com.jgy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jgy.entity.Permission;
import com.jgy.entity.RolePermission;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
* @author light
* @description 针对表【permission】的数据库操作Mapper
* @createDate 2022-10-20 15:34:01
* @Entity com.jgy.pojo.Permission
*/
@Mapper
public interface PermissionMapper extends BaseMapper<Permission> {

    @Select("select * from role_permission where role_id = #{roleId}")
    List<RolePermission> getRolePermissionByRoleId(Integer roleId);

    @Delete("delete from role_permission where role_id = #{roleId}")
    void deletePermissionsByRoleId(Integer roleId);

    @Insert("insert into role_permission(role_id, permission_id) values(#{roleId}, #{permissionId})")
    void insertRoleAndPermission(@Param("roleId") Integer roleId, @Param("permissionId") Integer permissionId);
}




